package seriable;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;

public class SerializationUtil {
	
	private static String path = "a.dat";
	
	public static void writeObject(Object o) throws FileNotFoundException, IOException{
		ObjectOutputStream os = new ObjectOutputStream(new FileOutputStream(path));
		os.writeObject(o);
		os.close();
	}
	
	public static Object readObject() throws FileNotFoundException, IOException, ClassNotFoundException{
		ObjectInputStream is = new ObjectInputStream(new FileInputStream(new File(path)));
		Object obj = is.readObject();
		is.close();
		return obj;
	}

}
